/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.game-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.card-content {
    position: relative;
    z-index: 1;
}

/* 标题样式 */
h1 {
    font-size: 2.5rem;
    color: #ff6b6b;
    margin-bottom: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

h2 {
    font-size: 2rem;
    color: #4ecdc4;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.3rem;
    color: #666;
    margin-bottom: 10px;
}

/* 认证界面样式 */
.auth-tabs {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: #f1f1f1;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #4ecdc4;
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin: 15px 0;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

.form-group input:focus {
    border-color: #4ecdc4;
}

.auth-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.message {
    margin-top: 10px;
    color: #ff6b6b;
    font-size: 0.9rem;
}

/* 用户信息界面 */
.user-info {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
}

.user-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 用户排名显示 */
.user-rank {
    text-align: center;
}

.rank-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.rank-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd93d;
}

.points-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd93d;
}

.points-icon {
    font-size: 1.5rem;
}

/* 游戏设置 */
.game-settings {
    margin: 20px 0;
}

.setting-group {
    margin: 15px 0;
}

.setting-group label {
    font-size: 1.1rem;
    margin-right: 10px;
    font-weight: 500;
}

.setting-group select {
    padding: 10px 15px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.3s;
}

.setting-group select:focus {
    border-color: #4ecdc4;
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.primary-btn {
    flex: 1;
    padding: 15px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.secondary-btn {
    flex: 1;
    padding: 15px;
    background: linear-gradient(45deg, #ff9a9e 0%, #fecfef 100%);
    color: #333;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 等待匹配动画 */
.waiting-animation {
    margin: 30px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 倒计时界面 */
.countdown-display {
    font-size: 5rem;
    font-weight: bold;
    color: #ff6b6b;
    margin: 30px 0;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* 游戏对战界面 */
.game-header {
    margin-bottom: 30px;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
}

.opponent-info, .self-info {
    flex: 1;
}

.vs {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b6b;
    margin: 0 20px;
}

/* 进度条样式 */
.progress-container {
    width: 100%;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    margin: 10px 0;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    transition: width 0.3s ease;
}

.opponent-progress .progress-bar {
    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
}

.self-progress .progress-bar {
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
}

.progress-text {
    font-size: 0.9rem;
    color: #666;
    text-align: center;
}

/* 回合指示器 */
.turn-indicator {
    margin: 20px 0;
    padding: 10px;
    border-radius: 10px;
    font-weight: bold;
}

.turn-indicator.your-turn {
    background: #d4edda;
    color: #155724;
}

.turn-indicator.opponent-turn {
    background: #f8d7da;
    color: #721c24;
}

/* 题目和输入区域 */
.question-container {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 40px;
    border-radius: 15px;
    margin: 20px 0;
    font-size: 2.5rem;
    min-height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.input-container {
    margin: 20px 0;
}

.answer-input {
    width: 100%;
    padding: 20px;
    font-size: 1.5rem;
    border: 3px solid #ddd;
    border-radius: 15px;
    outline: none;
    text-align: center;
    transition: border-color 0.3s;
}

.answer-input:focus {
    border-color: #4ecdc4;
}

/* 反馈样式 */
.feedback {
    margin: 20px 0;
    padding: 15px;
    border-radius: 10px;
    font-size: 1.2rem;
    display: none;
}

.feedback.correct {
    background-color: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
    display: block;
}

.feedback.incorrect {
    background-color: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    display: block;
}

/* 控制按钮 */
.control-buttons {
    margin-top: 20px;
}

.control-btn {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.submit-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

/* 游戏结束界面 */
.result-content {
    margin: 30px 0;
}

.winner-info {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.final-stats {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4ecdc4;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-content h3 {
    color: #ff6b6b;
    margin-bottom: 15px;
}

.modal-content button {
    margin-top: 20px;
}

/* 排行榜样式 */
.leaderboard-section {
    margin-top: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
}

.leaderboard-section h3 {
    color: #4ecdc4;
    margin-bottom: 20px;
    text-align: center;
}

.leaderboard-tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.8);
}

.leaderboard-content {
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-content.active {
    display: block;
}

/* 排行榜表头 */
.leaderboard-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: rgba(78, 205, 196, 0.2);
    border-radius: 8px;
    margin-bottom: 10px;
    font-weight: bold;
    color: #4ecdc4;
}

.rank-col {
    width: 20%;
    text-align: center;
}

.name-col {
    width: 50%;
    text-align: left;
}

.points-col {
    width: 30%;
    text-align: right;
}

/* 排行榜列表项 */
.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.leaderboard-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-item.current-user {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border: 2px solid #ff6b6b;
}

.rank-number {
    font-weight: bold;
    color: #ff6b6b;
    font-size: 1.2rem;
}

.rank-number.top3 {
    color: #ffd93d;
}

.player-name {
    font-weight: 500;
}

.player-points {
    font-weight: bold;
    color: #4ecdc4;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
}

/* 我的排名详情 */
.user-rank-detail {
    display: flex;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.rank-avatar {
    margin-right: 20px;
    text-align: center;
}

.avatar-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.rank-stats {
    flex: 1;
}

.stats-item {
    margin-bottom: 15px;
}

.stats-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stats-value {
    font-size: 1.3rem;
    font-weight: bold;
}

.points-highlight {
    color: #ffd93d;
}

.rank-highlight {
    color: #ff6b6b;
}

/* 相邻玩家 */
.leaderboard-neighbors h4 {
    color: #4ecdc4;
    margin-bottom: 15px;
}

.neighbors-list {
    background: white;
    border-radius: 10px;
    padding: 10px;
}

.neighbor-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #f8f9fa;
}

.neighbor-item:last-child {
    margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    
    .game-card {
        padding: 20px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .question-container {
        font-size: 2rem;
        padding: 30px 20px;
    }
    
    .answer-input {
        font-size: 1.3rem;
        padding: 15px;
    }
    
    .player-info {
        flex-direction: column;
    }
    
    .vs {
        margin: 10px 0;
    }
    
    .opponent-info, .self-info {
        width: 100%;
    }
    
    .final-stats {
        flex-direction: column;
        gap: 15px;
    }
}